package edu.sctu.alex.June.day20150615;

import java.io.*;

/**
 * Created by alex on 2015/6/15.
 */
public class BufferTest {

    public static void main(String[] args) {

        BufferedWriter bufferedWriter;
        BufferedReader bufferedReader;

        int ch = 0;
        try {
            FileWriter fileWriter = new FileWriter("F://hc.txt");
            FileReader fileReader = new FileReader("F://hc.txt");
            bufferedWriter = new BufferedWriter(fileWriter);

            bufferedWriter.write("i am yx!");
            bufferedWriter.newLine();
            bufferedWriter.write("test!");
            bufferedWriter.flush();
            bufferedWriter.close();

            bufferedReader = new BufferedReader(fileReader);
            while ((ch = bufferedReader.read())!=-1){
                System.out.print((char)ch);

            }
        } catch (IOException e) {
            e.printStackTrace();
        }




    }
    }
